<template>
  <div class="header">
    <div class="header-left">
      <span class="iconfont">&#xe624;</span>  
    </div>
    <div class="header-input">
      <span class="iconfont">&#xe632;</span>
      城市
    </div>
    <router-link tag="div" to="/City" class="header-right">
      {{this.city}}
      <span class="iconfont">&#xe62d;</span>
    </router-link>
  </div>
</template>

<script>
import {mapState, mapGetters} from 'vuex'
export default {
  name: 'headd',
  computed:{
    // ...mapState({
    //   currentCity:'city'
    // }),// this.currentCity
      ...mapState(['city']),//this.$store.state.city ---> this.city
      // ...mapGetters(['doubleCity']) //this.doubleCity 类似computed的功能
  }
}
</script>

<style lang="less" scoped>
@import '~styles/varibles.less';
 .header{
   display: flex;
   line-height: @headerHeight;
   background-color: @bgColor;
   color: #fff;
   .header-left{
     text-align: center;
     width:.64rem;
     font-size: .4rem;
   }
   .header-right{
     /*头部右边不会被挤下去*/
     /*这个可以继承*/
     min-width:1.04rem;
     padding:0 .1rem;
     text-align:center;
     span{
       margin-left: -.04rem;
       font-size: 0.24rem;
      //  width: 1rem;
      //  display: inline-block;
     }
   }
   .header-input{
     padding-left: .2rem;
     flex:1;
     height: .64rem;
     line-height: .64rem;
     margin: .12rem 0 0 .2rem;
     background: #fff;
     border-radius: .1rem;
     color:#ccc;
   }
 }
</style>